package com.maidou.qiantai.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.maidou.qiantai.mapper.AttrGroupMapper;
import com.maidou.qiantai.domain.AttrGroup;
import com.maidou.qiantai.service.IAttrGroupService;

/**
 * 商品属性分组Service业务层处理
 * 
 * @author maidou
 * @date 2024-03-13
 */
@Service
public class AttrGroupServiceImpl implements IAttrGroupService 
{
    @Autowired
    private AttrGroupMapper attrGroupMapper;

    /**
     * 查询商品属性分组
     * 
     * @param id 商品属性分组主键
     * @return 商品属性分组
     */
    @Override
    public AttrGroup selectAttrGroupById(Long id)
    {
        return attrGroupMapper.selectAttrGroupById(id);
    }

    /**
     * 查询商品属性分组列表
     * 
     * @param attrGroup 商品属性分组
     * @return 商品属性分组
     */
    @Override
    public List<AttrGroup> selectAttrGroupList(AttrGroup attrGroup)
    {
        return attrGroupMapper.selectAttrGroupList(attrGroup);
    }

    /**
     * 新增商品属性分组
     * 
     * @param attrGroup 商品属性分组
     * @return 结果
     */
    @Override
    public int insertAttrGroup(AttrGroup attrGroup)
    {
        attrGroup.setCreateTime(DateUtils.getNowDate());
        return attrGroupMapper.insertAttrGroup(attrGroup);
    }

    /**
     * 修改商品属性分组
     * 
     * @param attrGroup 商品属性分组
     * @return 结果
     */
    @Override
    public int updateAttrGroup(AttrGroup attrGroup)
    {
        attrGroup.setUpdateTime(DateUtils.getNowDate());
        return attrGroupMapper.updateAttrGroup(attrGroup);
    }

    /**
     * 批量删除商品属性分组
     * 
     * @param ids 需要删除的商品属性分组主键
     * @return 结果
     */
    @Override
    public int deleteAttrGroupByIds(Long[] ids)
    {
        return attrGroupMapper.deleteAttrGroupByIds(ids);
    }

    /**
     * 删除商品属性分组信息
     * 
     * @param id 商品属性分组主键
     * @return 结果
     */
    @Override
    public int deleteAttrGroupById(Long id)
    {
        return attrGroupMapper.deleteAttrGroupById(id);
    }

    /**
     * 批量获取分组信息
     * @param attrGroupIdByAttrId
     * @return
     */
    @Override
    public List<AttrGroup> selectAttrGroupBatchById(List<Long> attrGroupIdByAttrId) {
        List<AttrGroup>  list = attrGroupMapper.selectAttrGroupBatchById(attrGroupIdByAttrId);
        return list;
    }
}
